package com.ghsc.ghxc.jsb.ui.message.activity

import androidx.lifecycle.MutableLiveData
import com.cn.appcore.base.BaseViewModel
import com.cn.appcore.ext.executeResponse
import com.cn.appcore.http.bean.BaseResponse
import com.ghsc.ghxc.jsb.api.ApiMarket
import com.ghsc.ghxc.jsb.ui.message.bean.ChatDataResult
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

/**
 * 项目：GuoHuaJsb
 * 包名：com.ghsc.ghxc.jsb.ui.message.activity
 * 类名：GroupApplyListViewModel
 * 创建时间：2024/5/9 18:10
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
class GroupApplyListViewModel  : BaseViewModel() {




    /**  我的群聊 申请进群列表 **/
    var onMyGroupApplyListData = MutableLiveData<BaseResponse<ChatDataResult>>()
    fun onMyGroupApplyListMethod(paras: String) {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.onMyGroupApplyListData(paras) }
            executeResponse(
                response,
                { onMyGroupApplyListData.value = response},
                { againLoginMsg.value = response.msg}
            ) { errorMsg.value = response.msg }
        }
    }

    /**  我的群聊 申请进群 **/
    var onMyGroupApplyData = MutableLiveData<BaseResponse<Any>>()
    fun onMyGroupApplyMethod(paras: String) {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.onMyGroupApplyData(paras) }
            executeResponse(
                response,
                { onMyGroupApplyData.value = response},
                { againLoginMsg.value = response.msg}
            ) { errorMsg.value = response.msg }
        }
    }

}